
<!DOCTYPE html>

<html>
  
<!-- Mirrored from docs.sympy.org/latest/modules/geometry/index.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:24:24 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

    <title>Geometry &#8212; SymPy 1.9 documentation</title>
    <link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/default.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/graphviz.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/plot_directive.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-core.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-autocomplete.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-sphinx.css" />
    
    <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
    <script src="../../_static/jquery.js"></script>
    <script src="../../_static/underscore.js"></script>
    <script src="../../_static/doctools.js"></script>
    <script src="../../../../live.sympy.org/static/utilities.js"></script>
    <script src="../../../../live.sympy.org/static/external/classy.js"></script>
    <script src="../../../../live.sympy.org/static/live-core.js"></script>
    <script src="../../../../live.sympy.org/static/live-autocomplete.js"></script>
    <script src="../../../../live.sympy.org/static/live-sphinx.js"></script>
    <script async="async" src="../../../../cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest8331.js?config=TeX-AMS_HTML-full"></script>
    <script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["\\(", "\\)"]], "displayMath": [["\\[", "\\]"]]}})</script>
    
    <link rel="shortcut icon" href="../../_static/sympy-notailtext-favicon.ico"/>
    <link href="index.html" rel="canonical" />
    
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="Entities" href="entities.html" />
    <link rel="prev" title="Special" href="../functions/special.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="entities.html" title="Entities"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="../functions/special.html" title="Special"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" accesskey="U">SymPy Modules Reference</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Geometry</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="geometry">
<h1>Geometry<a class="headerlink" href="#geometry" title="Permalink to this headline">¶</a></h1>
<section id="introduction">
<h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
<p>The geometry module for SymPy allows one to create two-dimensional geometrical
entities, such as lines and circles, and query for information about these
entities. This could include asking the area of an ellipse, checking for
collinearity of a set of points, or finding the intersection between two lines.
The primary use case of the module involves entities with numerical values, but
it is possible to also use symbolic representations.</p>
</section>
<section id="available-entities">
<h2>Available Entities<a class="headerlink" href="#available-entities" title="Permalink to this headline">¶</a></h2>
<p>The following entities are currently available in the geometry module:</p>
<ul class="simple">
<li><p><a class="reference internal" href="points.html#sympy.geometry.point.Point" title="sympy.geometry.point.Point"><code class="xref py py-class docutils literal notranslate"><span class="pre">Point</span></code></a></p></li>
<li><p><a class="reference internal" href="lines.html#sympy.geometry.line.Line" title="sympy.geometry.line.Line"><code class="xref py py-class docutils literal notranslate"><span class="pre">Line</span></code></a>, <a class="reference internal" href="lines.html#sympy.geometry.line.Segment" title="sympy.geometry.line.Segment"><code class="xref py py-class docutils literal notranslate"><span class="pre">Segment</span></code></a>, <a class="reference internal" href="lines.html#sympy.geometry.line.Ray" title="sympy.geometry.line.Ray"><code class="xref py py-class docutils literal notranslate"><span class="pre">Ray</span></code></a></p></li>
<li><p><a class="reference internal" href="ellipses.html#sympy.geometry.ellipse.Ellipse" title="sympy.geometry.ellipse.Ellipse"><code class="xref py py-class docutils literal notranslate"><span class="pre">Ellipse</span></code></a>, <a class="reference internal" href="ellipses.html#sympy.geometry.ellipse.Circle" title="sympy.geometry.ellipse.Circle"><code class="xref py py-class docutils literal notranslate"><span class="pre">Circle</span></code></a></p></li>
<li><p><a class="reference internal" href="polygons.html#sympy.geometry.polygon.Polygon" title="sympy.geometry.polygon.Polygon"><code class="xref py py-class docutils literal notranslate"><span class="pre">Polygon</span></code></a>, <a class="reference internal" href="polygons.html#sympy.geometry.polygon.RegularPolygon" title="sympy.geometry.polygon.RegularPolygon"><code class="xref py py-class docutils literal notranslate"><span class="pre">RegularPolygon</span></code></a>, <a class="reference internal" href="polygons.html#sympy.geometry.polygon.Triangle" title="sympy.geometry.polygon.Triangle"><code class="xref py py-class docutils literal notranslate"><span class="pre">Triangle</span></code></a></p></li>
</ul>
<p>Most of the work one will do will be through the properties and methods of
these entities, but several global methods exist:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">intersection(entity1,</span> <span class="pre">entity2)</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">are_similar(entity1,</span> <span class="pre">entity2)</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">convex_hull(points)</span></code></p></li>
</ul>
<p>For a full API listing and an explanation of the methods and their return
values please see the list of classes at the end of this document.</p>
</section>
<section id="example-usage">
<h2>Example Usage<a class="headerlink" href="#example-usage" title="Permalink to this headline">¶</a></h2>
<p>The following Python session gives one an idea of how to work with some of the
geometry module.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="o">*</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="o">*</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">y</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">z</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">zp</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Point</span><span class="o">.</span><span class="n">is_collinear</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">)</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Point</span><span class="o">.</span><span class="n">is_collinear</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">zp</span><span class="p">)</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">zp</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">area</span>
<span class="go">1/2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">medians</span><span class="p">[</span><span class="n">x</span><span class="p">]</span>
<span class="go">Segment2D(Point2D(0, 0), Point2D(1, 1/2))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">m</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">medians</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">intersection</span><span class="p">(</span><span class="n">m</span><span class="p">[</span><span class="n">x</span><span class="p">],</span> <span class="n">m</span><span class="p">[</span><span class="n">y</span><span class="p">],</span> <span class="n">m</span><span class="p">[</span><span class="n">zp</span><span class="p">])</span>
<span class="go">[Point2D(2/3, 1/3)]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">c</span> <span class="o">=</span> <span class="n">Circle</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">l</span> <span class="o">=</span> <span class="n">Line</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="o">-</span><span class="mi">5</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">c</span><span class="o">.</span><span class="n">is_tangent</span><span class="p">(</span><span class="n">l</span><span class="p">)</span> <span class="c1"># is l tangent to c?</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">l</span> <span class="o">=</span> <span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">c</span><span class="o">.</span><span class="n">is_tangent</span><span class="p">(</span><span class="n">l</span><span class="p">)</span> <span class="c1"># is l tangent to c?</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">intersection</span><span class="p">(</span><span class="n">c</span><span class="p">,</span> <span class="n">l</span><span class="p">)</span>
<span class="go">[Point2D(-5*sqrt(2)/2, -5*sqrt(2)/2), Point2D(5*sqrt(2)/2, 5*sqrt(2)/2)]</span>
</pre></div>
</div>
</section>
<section id="intersection-of-medians">
<h2>Intersection of medians<a class="headerlink" href="#intersection-of-medians" title="Permalink to this headline">¶</a></h2>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Triangle</span><span class="p">,</span> <span class="n">intersection</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s2">&quot;a,b&quot;</span><span class="p">,</span> <span class="n">positive</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">y</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">z</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">)</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">area</span>
<span class="go">a*b/2</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">medians</span><span class="p">[</span><span class="n">x</span><span class="p">]</span>
<span class="go">Segment2D(Point2D(0, 0), Point2D(3*a/2, b/2))</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">intersection</span><span class="p">(</span><span class="n">t</span><span class="o">.</span><span class="n">medians</span><span class="p">[</span><span class="n">x</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">medians</span><span class="p">[</span><span class="n">y</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">medians</span><span class="p">[</span><span class="n">z</span><span class="p">])</span>
<span class="go">[Point2D(a, b/3)]</span>
</pre></div>
</div>
</section>
<section id="an-in-depth-example-pappus-hexagon-theorem">
<h2>An in-depth example: Pappus’ Hexagon Theorem<a class="headerlink" href="#an-in-depth-example-pappus-hexagon-theorem" title="Permalink to this headline">¶</a></h2>
<p>From Wikipedia (<a class="reference internal" href="#wikipappus" id="id1"><span>[WikiPappus]</span></a>):</p>
<blockquote>
<div><p>Given one set of collinear points <span class="math notranslate nohighlight">\(A\)</span>, <span class="math notranslate nohighlight">\(B\)</span>, <span class="math notranslate nohighlight">\(C\)</span>, and another set of collinear
points <span class="math notranslate nohighlight">\(a\)</span>, <span class="math notranslate nohighlight">\(b\)</span>, <span class="math notranslate nohighlight">\(c\)</span>, then the intersection points <span class="math notranslate nohighlight">\(X\)</span>, <span class="math notranslate nohighlight">\(Y\)</span>, <span class="math notranslate nohighlight">\(Z\)</span> of line pairs <span class="math notranslate nohighlight">\(Ab\)</span> and
<span class="math notranslate nohighlight">\(aB\)</span>, <span class="math notranslate nohighlight">\(Ac\)</span> and <span class="math notranslate nohighlight">\(aC\)</span>, <span class="math notranslate nohighlight">\(Bc\)</span> and <span class="math notranslate nohighlight">\(bC\)</span> are collinear.</p>
</div></blockquote>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="o">*</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="o">*</span>
<span class="go">&gt;&gt;&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">l1</span> <span class="o">=</span> <span class="n">Line</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">l2</span> <span class="o">=</span> <span class="n">Line</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="o">-</span><span class="mi">2</span><span class="p">))</span>
<span class="go">&gt;&gt;&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">def</span> <span class="nf">subs_point</span><span class="p">(</span><span class="n">l</span><span class="p">,</span> <span class="n">val</span><span class="p">):</span>
<span class="gp">... </span>   <span class="sd">&quot;&quot;&quot;Take an arbitrary point and make it a fixed point.&quot;&quot;&quot;</span>
<span class="gp">... </span>   <span class="n">t</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;t&#39;</span><span class="p">,</span> <span class="n">real</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">... </span>   <span class="n">ap</span> <span class="o">=</span> <span class="n">l</span><span class="o">.</span><span class="n">arbitrary_point</span><span class="p">()</span>
<span class="gp">... </span>   <span class="k">return</span> <span class="n">Point</span><span class="p">(</span><span class="n">ap</span><span class="o">.</span><span class="n">x</span><span class="o">.</span><span class="n">subs</span><span class="p">(</span><span class="n">t</span><span class="p">,</span> <span class="n">val</span><span class="p">),</span> <span class="n">ap</span><span class="o">.</span><span class="n">y</span><span class="o">.</span><span class="n">subs</span><span class="p">(</span><span class="n">t</span><span class="p">,</span> <span class="n">val</span><span class="p">))</span>
<span class="gp">...</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p11</span> <span class="o">=</span> <span class="n">subs_point</span><span class="p">(</span><span class="n">l1</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p12</span> <span class="o">=</span> <span class="n">subs_point</span><span class="p">(</span><span class="n">l1</span><span class="p">,</span> <span class="mi">6</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p13</span> <span class="o">=</span> <span class="n">subs_point</span><span class="p">(</span><span class="n">l1</span><span class="p">,</span> <span class="mi">11</span><span class="p">)</span>
<span class="go">&gt;&gt;&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p21</span> <span class="o">=</span> <span class="n">subs_point</span><span class="p">(</span><span class="n">l2</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p22</span> <span class="o">=</span> <span class="n">subs_point</span><span class="p">(</span><span class="n">l2</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p23</span> <span class="o">=</span> <span class="n">subs_point</span><span class="p">(</span><span class="n">l2</span><span class="p">,</span> <span class="mi">13</span><span class="p">)</span>
<span class="go">&gt;&gt;&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">ll1</span> <span class="o">=</span> <span class="n">Line</span><span class="p">(</span><span class="n">p11</span><span class="p">,</span> <span class="n">p22</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">ll2</span> <span class="o">=</span> <span class="n">Line</span><span class="p">(</span><span class="n">p11</span><span class="p">,</span> <span class="n">p23</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">ll3</span> <span class="o">=</span> <span class="n">Line</span><span class="p">(</span><span class="n">p12</span><span class="p">,</span> <span class="n">p21</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">ll4</span> <span class="o">=</span> <span class="n">Line</span><span class="p">(</span><span class="n">p12</span><span class="p">,</span> <span class="n">p23</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">ll5</span> <span class="o">=</span> <span class="n">Line</span><span class="p">(</span><span class="n">p13</span><span class="p">,</span> <span class="n">p21</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">ll6</span> <span class="o">=</span> <span class="n">Line</span><span class="p">(</span><span class="n">p13</span><span class="p">,</span> <span class="n">p22</span><span class="p">)</span>
<span class="go">&gt;&gt;&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">pp1</span> <span class="o">=</span> <span class="n">intersection</span><span class="p">(</span><span class="n">ll1</span><span class="p">,</span> <span class="n">ll3</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">pp2</span> <span class="o">=</span> <span class="n">intersection</span><span class="p">(</span><span class="n">ll2</span><span class="p">,</span> <span class="n">ll5</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">pp3</span> <span class="o">=</span> <span class="n">intersection</span><span class="p">(</span><span class="n">ll4</span><span class="p">,</span> <span class="n">ll6</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
<span class="go">&gt;&gt;&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Point</span><span class="o">.</span><span class="n">is_collinear</span><span class="p">(</span><span class="n">pp1</span><span class="p">,</span> <span class="n">pp2</span><span class="p">,</span> <span class="n">pp3</span><span class="p">)</span>
<span class="go">True</span>
</pre></div>
</div>
<section id="references">
<h3>References<a class="headerlink" href="#references" title="Permalink to this headline">¶</a></h3>
<dl class="citation">
<dt class="label" id="wikipappus"><span class="brackets"><a class="fn-backref" href="#id1">WikiPappus</a></span></dt>
<dd><p>“Pappus’s Hexagon Theorem” Wikipedia, the Free Encyclopedia.
Web. 26 Apr. 2013.
&lt;<a class="reference external" href="https://en.wikipedia.org/wiki/Pappus's_hexagon_theorem">https://en.wikipedia.org/wiki/Pappus’s_hexagon_theorem</a>&gt;</p>
</dd>
</dl>
</section>
</section>
<section id="miscellaneous-notes">
<h2>Miscellaneous Notes<a class="headerlink" href="#miscellaneous-notes" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><p>The area property of <code class="docutils literal notranslate"><span class="pre">Polygon</span></code> and <code class="docutils literal notranslate"><span class="pre">Triangle</span></code> may return a positive or
negative value, depending on whether or not the points are oriented
counter-clockwise or clockwise, respectively. If you always want a
positive value be sure to use the <code class="docutils literal notranslate"><span class="pre">abs</span></code> function.</p></li>
<li><p>Although <code class="docutils literal notranslate"><span class="pre">Polygon</span></code> can refer to any type of polygon, the code has been
written for simple polygons. Hence, expect potential problems if dealing
with complex polygons (overlapping sides).</p></li>
<li><p>Since SymPy is still in its infancy some things may not simplify
properly and hence some things that should return <code class="docutils literal notranslate"><span class="pre">True</span></code> (e.g.,
<code class="docutils literal notranslate"><span class="pre">Point.is_collinear</span></code>) may not actually do so. Similarly, attempting to find
the intersection of entities that do intersect may result in an empty
result.</p></li>
</ul>
</section>
<section id="future-work">
<h2>Future Work<a class="headerlink" href="#future-work" title="Permalink to this headline">¶</a></h2>
<section id="truth-setting-expressions">
<h3>Truth Setting Expressions<a class="headerlink" href="#truth-setting-expressions" title="Permalink to this headline">¶</a></h3>
<p>When one deals with symbolic entities, it often happens that an assertion
cannot be guaranteed. For example, consider the following code:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="o">*</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="o">*</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">z</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</span><span class="n">Symbol</span><span class="p">,</span> <span class="s1">&#39;xyz&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span><span class="n">p2</span><span class="p">,</span><span class="n">p3</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">x</span><span class="o">*</span><span class="n">y</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Point</span><span class="o">.</span><span class="n">is_collinear</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">)</span>
<span class="go">False</span>
</pre></div>
</div>
<p>Even though the result is currently <code class="docutils literal notranslate"><span class="pre">False</span></code>, this is not <em>always</em> true. If the
quantity <span class="math notranslate nohighlight">\(z - y - 2*y*z + 2*y**2 == 0\)</span> then the points will be collinear. It
would be really nice to inform the user of this because such a quantity may be
useful to a user for further calculation and, at the very least, being nice to
know. This could be potentially done by returning an object (e.g.,
GeometryResult) that the user could use. This actually would not involve an
extensive amount of work.</p>
</section>
<section id="three-dimensions-and-beyond">
<h3>Three Dimensions and Beyond<a class="headerlink" href="#three-dimensions-and-beyond" title="Permalink to this headline">¶</a></h3>
<p>Currently a limited subset of the geometry module has been extended to
three dimensions, but it certainly would be a good addition to extend
more. This would probably involve a fair amount of work since many of
the algorithms used are specific to two dimensions.</p>
</section>
<section id="geometry-visualization">
<h3>Geometry Visualization<a class="headerlink" href="#geometry-visualization" title="Permalink to this headline">¶</a></h3>
<p>The plotting module is capable of plotting geometric entities. See
<a class="reference internal" href="../plotting.html#plot-geom"><span class="std std-ref">Plotting Geometric Entities</span></a> in
the plotting module entry.</p>
</section>
<section id="submodules">
<h3>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h3>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="entities.html">Entities</a></li>
<li class="toctree-l1"><a class="reference internal" href="utils.html">Utils</a></li>
<li class="toctree-l1"><a class="reference internal" href="points.html">Points</a></li>
<li class="toctree-l1"><a class="reference internal" href="lines.html">Lines</a></li>
<li class="toctree-l1"><a class="reference internal" href="curves.html">Curves</a></li>
<li class="toctree-l1"><a class="reference internal" href="ellipses.html">Ellipses</a></li>
<li class="toctree-l1"><a class="reference internal" href="polygons.html">Polygons</a></li>
<li class="toctree-l1"><a class="reference internal" href="plane.html">Plane</a></li>
</ul>
</div>
</section>
</section>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../../index.html">
              <img class="logo" src="../../_static/sympylogo.png" alt="Logo"/>
            </a></p>
  <h3><a href="../../index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Geometry</a><ul>
<li><a class="reference internal" href="#introduction">Introduction</a></li>
<li><a class="reference internal" href="#available-entities">Available Entities</a></li>
<li><a class="reference internal" href="#example-usage">Example Usage</a></li>
<li><a class="reference internal" href="#intersection-of-medians">Intersection of medians</a></li>
<li><a class="reference internal" href="#an-in-depth-example-pappus-hexagon-theorem">An in-depth example: Pappus’ Hexagon Theorem</a><ul>
<li><a class="reference internal" href="#references">References</a></li>
</ul>
</li>
<li><a class="reference internal" href="#miscellaneous-notes">Miscellaneous Notes</a></li>
<li><a class="reference internal" href="#future-work">Future Work</a><ul>
<li><a class="reference internal" href="#truth-setting-expressions">Truth Setting Expressions</a></li>
<li><a class="reference internal" href="#three-dimensions-and-beyond">Three Dimensions and Beyond</a></li>
<li><a class="reference internal" href="#geometry-visualization">Geometry Visualization</a></li>
<li><a class="reference internal" href="#submodules">Submodules</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="../functions/special.html"
                        title="previous chapter">Special</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="entities.html"
                        title="next chapter">Entities</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../../_sources/modules/geometry/index.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="https://docs.sympy.org/latest/search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="entities.html" title="Entities"
             >next</a> |</li>
        <li class="right" >
          <a href="../functions/special.html" title="Special"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >SymPy Modules Reference</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Geometry</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2021 SymPy Development Team.
      Last updated on Sep 30, 2021.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.1.2.
    </div>
  </body>

<!-- Mirrored from docs.sympy.org/latest/modules/geometry/index.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:24:24 GMT -->
</html>